{% extends "geonode_base.html" %}
{% load markdownify %}
{% load i18n %}
{% load static from staticfiles %}
{% load base_tags %}

{% block title %} {% trans "Welcome!" %} - {{ block.super }} {% endblock %}

{% block body_class %}home{% endblock %}

{% block middle %}
  {{ block.super }}

  {% block hero %}
  {% if block.super %}
  {{ block.super }}
  {% else %}

{% if custom_theme.welcome_theme == 'JUMBOTRON_BG' or not slides %}
<div class="jumbotron">
  <div class="container gn-container">
      {% with jumbotron_welcome_title=custom_theme.jumbotron_welcome_title|default:"Welcome"|template_trans %}
      <h1>{% trans jumbotron_welcome_title %}</h1>
      {% endwith %}
      <p></p>
      {% with jumbotron_welcome_content=custom_theme.jumbotron_welcome_content|default:"GeoNode is an open source platform for sharing geospatial data and maps."|template_trans %}
      <p>{% trans jumbotron_welcome_content %}</p>
      {% endwith %}
      {% if not custom_theme.jumbotron_cta_hide %}
      <p><a class="btn btn-default btn-lg" target="_blank"
          href="{{custom_theme.jumbotron_cta_link|default:"https://docs.geonode.org/en/master/usage/index.html"}}"
          role="button">{{custom_theme.jumbotron_cta_text|default:_("Get Started &raquo;")}}</a></p>
      {% endif %}
  </div>
</div>
{% else %}
<div class="geonode-slide-show">
	<div class="jumbotron jumbotron--no_bg">
	   <div class="container gn-container">
		  <div id="myCarousel" class="carousel slide" data-ride="carousel">
			 <!-- Indicators -->
			 {% if slides.count > 1%}
			 <ol class="carousel-indicators">
				{% for slide in slides %}
				<li data-target="#myCarousel" data-slide-to="{{ forloop.counter | add:'-1' }}" class="{% if forloop.counter == 1 %}active{%endif%}"></li>
				{% endfor %}
			 </ol>
			 {% endif %}
       {% with jumbotron_welcome_title=custom_theme.jumbotron_welcome_title|default:"Welcome"|template_trans %}
       <h1 class="carousel-header">{% trans jumbotron_welcome_title %}</h1>
       {% endwith %}
			 <!-- Wrapper for slides -->
			 <div class="carousel-inner" role="listbox">
				{% for slide in slides %}
				<div class="item {% if forloop.counter == 1 %}active{%endif%}">
					{% if slide.jumbotron_slide_image %}
				   <img src="{{ slide.jumbotron_slide_image_thumbnail.url }}" alt="{{ slide.slide_name }}">
				   {% endif %}
				   {% if not slide.hide_jumbotron_slide_content %}
				   <div class="carousel-caption">
            {% with jumbotron_slide_content=slide.jumbotron_slide_content|markdownify %}
            {% trans jumbotron_slide_content %}
            {% endwith %}
				   </div>
				   {% endif %}
				</div>
				{% endfor %}                
			 </div>
			 <!-- Left and right controls -->
			 {% if slides.count > 1%}
			 <a class="left carousel-control" href="#myCarousel" data-slide="prev">
			 <span class="glyphicon glyphicon-chevron-left"></span>
			 <span class="sr-only">Previous</span>
			 </a>
			 <a class="right carousel-control" href="#myCarousel" data-slide="next">
			 <span class="glyphicon glyphicon-chevron-right"></span>
			 <span class="sr-only">Next</span>
			 </a>
			 {% endif %}
		  </div>
	   </div>
	</div>
 </div>
{% endif %}
  {% endif %}
  {% endblock hero %}

  {% block mainbody %}

      {% block bigsearch %}
      {% if block.super %}
      {{ block.super }}
      {% else %}
      <div class="big-search">
      	<div class="container">
      		<h1>{% trans "Search for Data." %}</h1>
      		<div class="search">
      			<form id="main_search" action="{% url "search" %}" >
      				<span class="fa fa-search fa-3x"></span>
      				{% if HAYSTACK_SEARCH %}
      				<input id="main_search_input" type="text" placeholder="{% trans 'Search' %}" class="form-control" name="q" autocomplete="off">
                    <input type="hidden" name="abstract__icontains" id="main_search_abstract_input" placeholder="{% trans 'Search' %}" >
                    <input type="hidden" name="purpose__icontains" id="main_search_purpose_input" placeholder="{% trans 'Search' %}" >
                    <input type="hidden" name="f_method" id="main_filtering_type" value="or" >
      				{% else %}
      				<input id="main_search_input" type="text" placeholder="{% trans 'Search' %}" class="form-control" autocomplete="off" name="title__icontains">
                    <input type="hidden" name="abstract__icontains" id="main_search_abstract_input">
                    <input type="hidden" name="purpose__icontains" id="main_search_purpose_input">
                    <input type="hidden" name="f_method" id="main_filtering_type" value="or" >
      				{% endif %}
      			</form>
      		</div>
      		<p><a class="btn btn-default btn-lg" href="{% url "search" %}">{% trans "Advanced Search" %}</a></p>
      	</div>
      </div>
      {% endif %}
      {% endblock bigsearch %}

	  {% block showcase %}
      <section id="showcase">
        <div class="row">
          <div class="container text-center">
            <div class="row home-facets">
            {% with facet_type='home' %}
             {% facets as facets %}
              <div class="col-md-6">
                <p><a href="{% url "layer_browse" %}"><i class="fa fa-square-o fa-4x rotate-45"></i></a></p>
                <h2><a href="{% url "layer_browse" %}">{{ facets.layer|default:_("No") }} {% blocktrans count counter=facets.layer %}Layer{% plural %}Layers{% endblocktrans %}</a></h2>
                <p>{% trans "Click to search for geospatial data published by other users, organizations and public sources. Download data in standard formats." %}</p>
                {% if user.is_authenticated %}
                <p class="text-center"><a class="btn btn-default" href="{% url "layer_upload" %}" role="button">{% trans "Add layers" %} &raquo;</a></p>
                {% else %}
                <p class="text-center"><a class="btn btn-default" href="{% url "layer_browse" %}" role="button">{% trans "Explore layers" %} &raquo;</a></p>
                {% endif %}
              </div>
              <div class="col-md-6">
                <p><a href="{% url "maps_browse" %}"><i class="fa fa-map-marker fa-4x"></i></a></p>
                <h2><a href="{% url "maps_browse" %}">{{ facets.map|default:_("No") }} {% blocktrans count counter=facets.map %}Map{% plural %}Maps{% endblocktrans %}</a></h2>
                <p>{% trans "Data is available for browsing, aggregating and styling to generate maps which can be saved, downloaded, shared publicly or restricted to specify users only." %}</p>
                {% if user.is_authenticated %}
                <p><a class="btn btn-default" href="{% url "new_map" %}" role="button">{% trans "Create maps" %} &raquo;</a></p>
                {% else %}
                <p><a class="btn btn-default" href="{% url "maps_browse" %}" role="button">{% trans "Explore maps" %} &raquo;</a></p>
                {% endif %}
              </div>
              <div class="col-md-6">
                <p><a href="{% url "document_browse" %}"><i class="fa fa-newspaper-o fa-4x"></i></a></p>
                <h2><a href="{% url "document_browse" %}">{{ facets.document|default:_("No") }} {% blocktrans count counter=facets.document %}Document{% plural %}Documents{% endblocktrans %}</a></h2>
                <p>{% trans "As for the layers and maps GeoNode allows to publish tabular and text data, manage theirs metadata and associated documents." %}</p>
                {% if user.is_authenticated %}
                <p class="text-center"><a class="btn btn-default" href="{% url "document_browse" %}" role="button">{% trans "Add documents" %} &raquo;</a></p>
                {% else %}
                <p class="text-center"><a class="btn btn-default" href="{% url "document_browse" %}" role="button">{% trans "Explore documents" %} &raquo;</a></p>
                {% endif %}
              </div>
              <div class="col-md-6">
                <p><a href="{% url "profile_browse" %}"><i class="fa fa-user fa-4x"></i></a></p>
                <h2><a href="{% url "profile_browse" %}">{{ facets.user|default:_("No") }} {% blocktrans count counter=facets.user %}User{% plural %}Users{% endblocktrans %}</a></h2>
                <p>{% trans "Geonode allows registered users to easily upload geospatial data and various documents in several formats." %}</p>
                <p><a class="btn btn-default" href="{% url "profile_browse" %}" role="button">{% trans "See users" %} &raquo;</a></p>
              </div>
            {% endwith %}
            </div>
          </div>
        </div>
      </section>
	  {% endblock showcase %}

	  {% block datasets %}
    <section id="datasets">
      {% get_visibile_resources request.user %}
      <div ng-app="featured" ng-if="featured.length > 0" ng-cloak class="row">
          <div class="container text-center">
            <h2>{% trans "Featured Datasets" %}</h2>
            <div class="row">
                {% verbatim %}
                <div ng-repeat="item in featured" class="col-xs-6 col-sm-6 col-md-3">
                  <a href="{{ item.detail_url }}"><img ng-src="{{ item.thumbnail_url }}" style="width: 100%" /></a>
                  <h4>{{ item.title | limitTo: 20 }}{{item.title.length > 20 ? '...' : ''}}</h4>
                </div>
                {% endverbatim %}
            </div>
          </div>
      </div>
      </div>
    </section>
    {% endblock datasets %}

      {% block partners %}
        {% if custom_theme.partners.all %}
        <section id="partners">
        <div class="container text-center">
          {% with partners_title=custom_theme.partners_title|default:"Our partners"|template_trans %}
          <h2>{% trans partners_title %}</h2>
          {% endwith %}
          <div class="row">
              {% for partner in custom_theme.partners.all %}
              <div class="col-md-2">
                <a style="font-size: 12px" href="{{ partner.partner_link|safe }}" target="_blank">
                  {% if partner.logo %}
                  <div class="partner_logo" style="background-image: url({{partner.logo.url}})">
                  {% else %}
                  {{ partner.title|safe }}
                  {% endif %}
                  </div>
                </a>
              </div>
              {% endfor %}
          </div>
        </div>
        </section>
        {% endif %}
      {% endblock partners %}

      {% block cookielawinfo %}
      {% if custom_theme.cookie_law_info_bar_enabled %}
          <div id="cookie-law-info-bar">
              <h5 class="cli_messagebar_head">{{ custom_theme.cookie_law_info_bar_head }}</h5>
              <span>{{ custom_theme.cookie_law_info_bar_text|safe }}
                  <a data-cli_action="accept" id="cookie_action_close_header" target="_blank"  class="medium cli-plugin-button cli-plugin-main-button cookie_action_close_header cli_action_button" style="display:inline-block; ">{% trans "Accept" %}</a>
                  <a id="cookie_action_close_header_reject" class="medium cli-plugin-button cli-plugin-main-button cookie_action_close_header_reject cli_action_button"  data-cli_action="reject">{% trans "Reject" %}</a>
                  <a id="CONSTANT_OPEN_URL" href='{{ custom_theme.cookie_law_info_leave_url }}' class="medium cli-plugin-button cli-plugin-main-button" style="display:inline-block;">{% trans "Leave" %}</a>
              </span>
          </div>
          <div id="cookie-law-info-again" style="display:none;">
              <span id="cookie_hdr_showagain">{{ custom_theme.cookie_law_info_showagain_head }}</span>
          </div>
          <div class="cli-modal-backdrop cli-fade cli-settings-overlay"></div>
          <div class="cli-modal-backdrop cli-fade cli-popupbar-overlay"></div>
          <script type="text/javascript">
            /* <![CDATA[ */
            cli_cookiebar_settings='{"animate_speed_hide":"{{custom_theme.cookie_law_info_animate_speed_hide}}","animate_speed_show":"{{custom_theme.cookie_law_info_animate_speed_show}}","background":"{{custom_theme.cookie_law_info_background}}","border":"{{custom_theme.cookie_law_info_border}}","border_on":{{custom_theme.cookie_law_info_border_on}},"button_1_button_colour":"{{custom_theme.cookie_law_info_button_1_button_colour}}","button_1_button_hover":"{{custom_theme.cookie_law_info_button_1_button_hover}}","button_1_link_colour":"{{custom_theme.cookie_law_info_button_1_link_colour}}","button_1_as_button":{{custom_theme.cookie_law_info_button_1_as_button}},"button_1_new_win":{{custom_theme.cookie_law_info_button_1_new_win}},"button_2_button_colour":"{{custom_theme.cookie_law_info_button_2_button_colour}}","button_2_button_hover":"{{custom_theme.cookie_law_info_button_2_button_hover}}","button_2_link_colour":"{{custom_theme.cookie_law_info_button_2_link_colour}}","button_2_as_button":{{custom_theme.cookie_law_info_button_2_as_button}},"button_2_hidebar":{{custom_theme.cookie_law_info_button_2_hidebar}},"button_3_button_colour":"{{custom_theme.cookie_law_info_button_3_button_colour}}","button_3_button_hover":"{{custom_theme.cookie_law_info_button_3_button_hover}}","button_3_link_colour":"{{custom_theme.cookie_law_info_button_3_link_colour}}","button_3_as_button":{{custom_theme.cookie_law_info_button_3_as_button}},"button_3_new_win":{{custom_theme.cookie_law_info_button_3_new_win}},"button_4_button_colour":"{{custom_theme.cookie_law_info_button_4_button_colour}}","button_4_button_hover":"{{custom_theme.cookie_law_info_button_4_button_hover}}","button_4_link_colour":"{{custom_theme.cookie_law_info_button_4_link_colour}}","button_4_as_button":{{custom_theme.cookie_law_info_button_4_as_button}},"font_family":"{{custom_theme.cookie_law_info_font_family}}","header_fix":{{custom_theme.cookie_law_info_header_fix}},"notify_animate_hide":{{custom_theme.cookie_law_info_notify_animate_hide}},"notify_animate_show":{{custom_theme.cookie_law_info_notify_animate_show}},"notify_div_id":"{{custom_theme.cookie_law_info_notify_div_id}}","notify_position_horizontal":"{{custom_theme.cookie_law_info_notify_position_horizontal}}","notify_position_vertical":"{{custom_theme.cookie_law_info_notify_position_vertical}}","scroll_close":{{custom_theme.cookie_law_info_scroll_close}},"scroll_close_reload":{{custom_theme.cookie_law_info_scroll_close_reload}},"accept_close_reload":{{custom_theme.cookie_law_info_accept_close_reload}},"reject_close_reload":{{custom_theme.cookie_law_info_reject_close_reload}},"showagain_tab":{{custom_theme.cookie_law_info_showagain_tab}},"showagain_background":"{{custom_theme.cookie_law_info_showagain_background}}","showagain_border":"{{custom_theme.cookie_law_info_showagain_border}}","showagain_div_id":"{{custom_theme.cookie_law_info_showagain_div_id}}","showagain_x_position":"{{custom_theme.cookie_law_info_showagain_x_position}}","text":"{{custom_theme.cookie_law_info_text}}","show_once_yn":{{custom_theme.cookie_law_info_show_once_yn}},"show_once":"{{custom_theme.cookie_law_info_show_once}}","logging_on":{{custom_theme.cookie_law_info_logging_on}},"as_popup":{{custom_theme.cookie_law_info_as_popup}},"popup_overlay":{{custom_theme.cookie_law_info_popup_overlay}},"bar_heading_text":"{{custom_theme.cookie_law_info_bar_heading_text}}","cookie_bar_as":"{{custom_theme.cookie_law_info_cookie_bar_as}}","popup_showagain_position":"{{custom_theme.cookie_law_info_popup_showagain_position}}","widget_position":"{{custom_theme.cookie_law_info_widget_position}}"}';
            /* ]]> */
          </script>
      {% endif %}
      {% endblock cookielawinfo %}

  {% endblock mainbody %}

{% endblock middle %}

{% block extra_script %}
    <script type="text/javascript">
      $('#main_search').on('submit', (e) => {
          $('#main_search_abstract_input')[0].value =$('#main_search_input')[0].value;
          $('#main_search_purpose_input')[0].value = $('#main_search_input')[0].value;
      });
    </script>
{{ block.super }}
{% if DEBUG_STATIC %}
<script src="{% static "lib/js/angular.js" %}"></script>
{% endif %}
<script type="text/javascript">
    FEATURED_URL = '{% url 'api_dispatch_list' api_name='api' resource_name='featured' %}'
    'use strict';
    (function(){
      var module = angular.module('featured', []);
      module.run(function($http, $rootScope){
		$http.get(FEATURED_URL).then(successCallback, errorCallback);

		function successCallback(data) {
			//success code
          $rootScope.featured = data.data.objects;
		};

		function errorCallback(error) {
			//error code
		};
      });
    })();
</script>
<script>
	$('[data-toggle="tooltip"]').tooltip({container: 'body'});
</script>
<script type='text/javascript'>
/* <![CDATA[ */
var Cli_Data = {"nn_cookie_ids":[],"cookielist":[]};
/* ]]> */
</script>
<script type="text/javascript" src="{% static "geonode/js/cookie-law-info/cookie-law-info-public.js" %}"></script>
{% endblock extra_script %}
